export class NavbarService {
    static Current: NavbarService = new NavbarService();
    private routerProvider: IRouterProvider;
    Register(routerProvider: IRouterProvider) {
        this.routerProvider = routerProvider;
    }
    OnGoback: () => void;
    OnAddData: () => void;
    NavigateChangeEvent: () => void;
    async Navigate(args: any[]) {
        this.OnAddData = null;
        if (this.routerProvider) await this.routerProvider.navigate(args);
        else throw "RouterProvider can not be null";
        this.NavigateChangeEvent && this.NavigateChangeEvent();
    }
}

export interface IRouterProvider {
    navigate: (...args: any[]) => Promise<boolean>;
}